from config import AppConfig
from data_processor import DataProcessor
from ui import MainUI
from PyQt5.QtWidgets import QApplication, QMainWindow
import sys  # 将sys导入移到顶部

class MainApplication:
    def __init__(self):
        self.app = QApplication(sys.argv)  # 先创建QApplication
        self.config = AppConfig()
        self.data_processor = DataProcessor(self.config)
        self.ui = MainUI(self.config, self.data_processor)
        
    def run(self):
        """运行应用程序"""
        self.ui.show()  # 显示主窗口
        sys.exit(self.app.exec_())

if __name__ == "__main__":
    app = MainApplication()
    app.run()